using System;
using OracleInternal.Common;

namespace Oracle.ManagedDataAccess.Client
{
	public sealed class OracleInfoMessageEventArgs : EventArgs
	{
		private OracleErrorCollection m_oraErrors;

		private string m_message;

		private string m_source;

		public OracleErrorCollection Errors => m_oraErrors;

		public string Message => m_message;

		public string Source => m_source;

		internal OracleInfoMessageEventArgs(OracleErrorCollection oraErrors)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleInfoMessageEventArgs, OracleTraceFuncName.ctor);
			}
			try
			{
				m_oraErrors = oraErrors;
				m_message = oraErrors[0].Message;
				m_source = oraErrors[0].Source;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleInfoMessageEventArgs, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleInfoMessageEventArgs, OracleTraceFuncName.ctor);
				}
			}
		}

		public override string ToString()
		{
			return m_message;
		}
	}
}
